package com.a.b.c.d.e.curls;

import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.Scanner;

/**
 * Created on 2021/10/11.
 *
 * @author yanshuchun
 */
public class SZAClass {
    public static void main(String[] args) throws IOException {
//        URL url = new URL("http://98.push2.eastmoney.com/api/qt/clist/get?cb=jQuery112409400806067154106_1633916060462&pn=1&pz=20&po=0&np=1&ut=bd1d9ddb04089700cf9c27f6f7426281&fltt=2&invt=2&fid=f3&fs=m:1+t:2,m:1+t:23&fields=f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f12,f13,f14,f15,f16,f17,f18,f20,f21,f23,f24,f25,f22,f11,f62,f128,f136,f115,f152&_=1633916060549");
//        URL url = new URL("http://98.push2.eastmoney.com/api/qt/clist/get?cb=jQuery112409400806067154106_1633916060462&pn=1&pz=20&po=1&np=1&ut=bd1d9ddb04089700cf9c27f6f7426281&fltt=2&invt=2&fid=f3&fs=m:0+t:6,m:0+t:80&fields=f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f12,f13,f14,f15,f16,f17,f18,f20,f21,f23,f24,f25,f22,f11,f62,f128,f136,f115,f152&_=1633916060573");
        URL url = new URL("http://98.push2.eastmoney.com/api/qt/clist/get?cb=jQuery112409400806067154106_1633916060458&pn=1&pz=40&po=1&np=1&ut=bd1d9ddb04089700cf9c27f6f7426281&fltt=2&invt=2&fid=f3&fs=m:1+t:2,m:1+t:23&fields=f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f12,f13,f14,f15,f16,f17,f18,f20,f21,f23,f24,f25,f22,f11,f62,f128,f136,f115,f152&_=1633916060517");
        HttpURLConnection httpConn = (HttpURLConnection) url.openConnection();
        httpConn.setRequestMethod("GET");

        httpConn.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:93.0) Gecko/20100101 Firefox/93.0");
        httpConn.setRequestProperty("Accept", "*/*");
        httpConn.setRequestProperty("Accept-Language", "zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2");
        httpConn.setRequestProperty("DNT", "1");
        httpConn.setRequestProperty("Connection", "keep-alive");
        httpConn.setRequestProperty("Referer", "http://quote.eastmoney.com/");
        httpConn.setRequestProperty("Pragma", "no-cache");
        httpConn.setRequestProperty("Cache-Control", "no-cache");

        httpConn.setRequestProperty("Cookie", "em_hq_fls=js; HAList=a-sz-300059-%u4E1C%u65B9%u8D22%u5BCC%2Ca-sz-300209-%u5929%u6CFD%u4FE1%u606F%2Ca-sh-600900-%u957F%u6C5F%u7535%u529B%2Cf-0-000001-%u4E0A%u8BC1%u6307%u6570; qgqp_b_id=2ec8296ad6c6e46a1b54f86ac5c9c812; intellpositionL=1522.4px; intellpositionT=1085px; cowminicookie=true; em-quote-version=topspeed; _qddaz=QD.l6ephm.qqbuqi.kuhtd8zl; st_si=15629216037450; st_sn=17; st_psi=20211011093626398-113200301321-3061197401; st_asi=delete; st_pvi=19958116574134; st_sp=2021-09-27%2014%3A51%3A33; st_inirUrl=https%3A%2F%2Fwww.baidu.com%2Flink");
        httpConn.setRequestProperty("Cookie", "em_hq_fls=js; HAList=a-sz-300059-%u4E1C%u65B9%u8D22%u5BCC%2Ca-sz-300209-%u5929%u6CFD%u4FE1%u606F%2Ca-sh-600900-%u957F%u6C5F%u7535%u529B%2Cf-0-000001-%u4E0A%u8BC1%u6307%u6570; qgqp_b_id=2ec8296ad6c6e46a1b54f86ac5c9c812; intellpositionL=1522.4px; intellpositionT=1085px; cowminicookie=true; em-quote-version=topspeed; _qddaz=QD.l6ephm.qqbuqi.kuhtd8zl; st_si=15629216037450; st_sn=17; st_psi=20211011093626398-113200301321-3061197401; st_asi=delete; st_pvi=19958116574134; st_sp=2021-09-27%2014%3A51%3A33; st_inirUrl=https%3A%2F%2Fwww.baidu.com%2Flink");


        InputStream responseStream = httpConn.getResponseCode() / 100 == 2
                ? httpConn.getInputStream()
                : httpConn.getErrorStream();
        Scanner s = new Scanner(responseStream).useDelimiter("\\A");
        String response = s.hasNext() ? s.next() : "";
        System.out.println(response);
    }
}


//class Main {
//
//    public static void main(String[] args) throws IOException {
//        URL url = new URL("http://98.push2.eastmoney.com/api/qt/clist/get?cb=jQuery112409400806067154106_1633916060462&pn=1&pz=20&po=0&np=1&ut=bd1d9ddb04089700cf9c27f6f7426281&fltt=2&invt=2&fid=f3&fs=m:1+t:2,m:1+t:23&fields=f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f12,f13,f14,f15,f16,f17,f18,f20,f21,f23,f24,f25,f22,f11,f62,f128,f136,f115,f152&_=1633916060549");
//        HttpURLConnection httpConn = (HttpURLConnection) url.openConnection();
//        httpConn.setRequestMethod("GET");
//
//        httpConn.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:93.0) Gecko/20100101 Firefox/93.0");
//        httpConn.setRequestProperty("Accept", "*/*");
//        httpConn.setRequestProperty("Accept-Language", "zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2");
//        httpConn.setRequestProperty("DNT", "1");
//        httpConn.setRequestProperty("Connection", "keep-alive");
//        httpConn.setRequestProperty("Referer", "http://quote.eastmoney.com/");
//        httpConn.setRequestProperty("Pragma", "no-cache");
//        httpConn.setRequestProperty("Cache-Control", "no-cache");
//
//        httpConn.setRequestProperty("Cookie", "em_hq_fls=js; HAList=a-sz-300059-%u4E1C%u65B9%u8D22%u5BCC%2Ca-sz-300209-%u5929%u6CFD%u4FE1%u606F%2Ca-sh-600900-%u957F%u6C5F%u7535%u529B%2Cf-0-000001-%u4E0A%u8BC1%u6307%u6570; qgqp_b_id=2ec8296ad6c6e46a1b54f86ac5c9c812; intellpositionL=1522.4px; intellpositionT=1085px; cowminicookie=true; em-quote-version=topspeed; _qddaz=QD.l6ephm.qqbuqi.kuhtd8zl; st_si=15629216037450; st_sn=17; st_psi=20211011093626398-113200301321-3061197401; st_asi=delete; st_pvi=19958116574134; st_sp=2021-09-27%2014%3A51%3A33; st_inirUrl=https%3A%2F%2Fwww.baidu.com%2Flink");
//
//        InputStream responseStream = httpConn.getResponseCode() / 100 == 2
//                ? httpConn.getInputStream()
//                : httpConn.getErrorStream();
//        Scanner s = new Scanner(responseStream).useDelimiter("\\A");
//        String response = s.hasNext() ? s.next() : "";
//        System.out.println(response);
//    }
//}


//class Main {
//
//    public static void main(String[] args) throws IOException {
//        URL url = new URL("http://98.push2.eastmoney.com/api/qt/clist/get?cb=jQuery112409400806067154106_1633916060462&pn=1&pz=20&po=1&np=1&ut=bd1d9ddb04089700cf9c27f6f7426281&fltt=2&invt=2&fid=f3&fs=m:0+t:6,m:0+t:80&fields=f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f12,f13,f14,f15,f16,f17,f18,f20,f21,f23,f24,f25,f22,f11,f62,f128,f136,f115,f152&_=1633916060573");
//        HttpURLConnection httpConn = (HttpURLConnection) url.openConnection();
//        httpConn.setRequestMethod("GET");
//
//        httpConn.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:93.0) Gecko/20100101 Firefox/93.0");
//        httpConn.setRequestProperty("Accept", "*/*");
//        httpConn.setRequestProperty("Accept-Language", "zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2");
//        httpConn.setRequestProperty("DNT", "1");
//        httpConn.setRequestProperty("Connection", "keep-alive");
//        httpConn.setRequestProperty("Referer", "http://quote.eastmoney.com/");
//        httpConn.setRequestProperty("Pragma", "no-cache");
//        httpConn.setRequestProperty("Cache-Control", "no-cache");
//
//        httpConn.setRequestProperty("Cookie", "em_hq_fls=js; HAList=a-sz-300059-%u4E1C%u65B9%u8D22%u5BCC%2Ca-sz-300209-%u5929%u6CFD%u4FE1%u606F%2Ca-sh-600900-%u957F%u6C5F%u7535%u529B%2Cf-0-000001-%u4E0A%u8BC1%u6307%u6570; qgqp_b_id=2ec8296ad6c6e46a1b54f86ac5c9c812; intellpositionL=1522.4px; intellpositionT=1085px; cowminicookie=true; em-quote-version=topspeed; _qddaz=QD.l6ephm.qqbuqi.kuhtd8zl; st_si=15629216037450; st_sn=18; st_psi=20211011094406464-113200301321-5111097618; st_asi=delete; st_pvi=19958116574134; st_sp=2021-09-27%2014%3A51%3A33; st_inirUrl=https%3A%2F%2Fwww.baidu.com%2Flink");
//
//        InputStream responseStream = httpConn.getResponseCode() / 100 == 2
//                ? httpConn.getInputStream()
//                : httpConn.getErrorStream();
//        Scanner s = new Scanner(responseStream).useDelimiter("\\A");
//        String response = s.hasNext() ? s.next() : "";
//        System.out.println(response);
//    }
//}